package com.iory.tianwangterminator;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class CityActivity extends ListActivity {
	static final String CITIES[];
	static final String RTSPS[];
	
	static 
	{
		
		String chengdu[] = new String[56];
		chengdu[0] = "蓓蕾幼儿园中一班";
		chengdu[1] = "合江亭区残联";
		chengdu[2] = "贝森路青羊大道口";
		chengdu[3] = "火车北站广场9";
		chengdu[4] = "红照壁街25号";
		chengdu[5] = "汉江路1号";
		chengdu[6] = "成都花园";
		chengdu[7] = "蓓蕾幼儿园大班";
		chengdu[8] = "青白江机房";
		chengdu[9] = "二环路东四段与锦东路交叉口";
		chengdu[10] = "成都站前人民商场公交路侧";
		chengdu[11] = "成都温鸭子";
		chengdu[12] = "群康路51号附一号";
		chengdu[13] = "府南新区路口";
		chengdu[14] = "万紫时装城快三秒门口";
		chengdu[15] = "名翠路清江东路口";
		chengdu[16] = "总府路46号";
		chengdu[17] = "宁夏街与万和路之间绿化带";
		chengdu[18] = "督院街人南二段80号锦江宾馆";
		chengdu[19] = "庆云南街二医院门口";
		chengdu[20] = "清江中路财大门口57号";
		chengdu[21] = "名翠路清江东路口";
		chengdu[22] = "北站广场8";
		chengdu[23] = "新津中国移动营业厅";
		chengdu[24] = "蓓蕾幼儿园小二班";
		chengdu[25] = "蓓蕾幼儿园大厅";
		chengdu[26] = "蓓蕾幼儿园多功能厅";
		chengdu[27] = "蓓蕾幼儿园中班";
		chengdu[28] = "蓓蕾幼儿园学前班";
		chengdu[29] = "永陵路口";
		chengdu[30] = "蓓蕾幼儿园操场右";
		chengdu[31] = "蓓蕾幼儿园小二班";
		CITIES = chengdu;
		String chengdu1[] = new String[56];
		chengdu1[0] = "rtsp://218.205.231.149:554/live/1/585814D16E7E409C/5609536355901269.sdp?id=guest&t=1315322128&en=59298799e58e9b38f15169f1a611a817&rs=wap";
		chengdu1[1] = "rtsp://218.205.231.149:554/live/1/27D07A4701104459/53515ace5f2c5dae.sdp?id=guest&t=1315322128&en=59298799e58e9b38f15169f1a611a817&rs=wap";
		chengdu1[2] = "rtsp://218.205.231.149:554/live/1/466937CA12C82DE0/7cc09337564811eb.sdp?id=guest&t=1315322129&en=24e49fc6e532bf4a8a8ebc82e22b3000&rs=wap";
		chengdu1[3] = "rtsp://218.205.231.149:554/live/1/5E59316B72A234EB/669891f863374e0d.sdp?id=guest&t=1315322129&en=24e49fc6e532bf4a8a8ebc82e22b3000&rs=wap";
		chengdu1[4] = "rtsp://218.205.231.149:554/live/1/7B32251532CA35C0/b1a6d86aa087fd15.sdp?id=guest&t=1315322129&en=24e49fc6e532bf4a8a8ebc82e22b3000&rs=wap";
		chengdu1[5] = "rtsp://218.205.231.149:554/live/1/3BAA039735D01614/a1aaf6574b2c7b10.sdp?id=guest&t=1315322130&en=698b2de607b43c61b46638578e9d5009&rs=wap";
		chengdu1[6] = "rtsp://218.205.231.149:554/live/1/6C7213EC450B2EF8/363712e683f3bcd0.sdp?id=guest&t=1315322130&en=698b2de607b43c61b46638578e9d5009&rs=wap";
		chengdu1[7] = "rtsp://218.205.231.149:554/live/1/37D826721708254B/1616219955815715.sdp?id=guest&t=1315322131&en=4bd0036e0a22b7c4002c3c6bac30e6af&rs=wap";
		chengdu1[8] = "rtsp://218.205.231.149:554/live/1/2EAB13731C906C12/0510302779015841.sdp?id=guest&t=1315322131&en=4bd0036e0a22b7c4002c3c6bac30e6af&rs=wap";
		chengdu1[9] = "rtsp://218.205.231.149:554/live/1/65B734FB35E4707E/f5006a1a42c745e5.sdp?id=guest&t=1315322132&en=c38c8c152be230fb1b065b3be3c8c1c2&rs=wap";
		chengdu1[10] = "rtsp://218.205.231.149:554/live/1/0D8B3E252B1926E5/51b7c14ad43c8643.sdp?id=guest&t=1315322132&en=c38c8c152be230fb1b065b3be3c8c1c2&rs=wap";
		chengdu1[11] = "rtsp://218.205.231.149:554/live/1/795B030D238307B4/3d4d39f8d98f6d2f.sdp?id=guest&t=1315322132&en=c38c8c152be230fb1b065b3be3c8c1c2&rs=wap";
		chengdu1[12] = "rtsp://218.205.231.149:554/live/1/3B7D4C49332A47EC/8163fc40199761ad.sdp?id=guest&t=1315322133&en=3f9b071f939290361dc0952a8a403470&rs=wap";
		chengdu1[13] = "rtsp://218.205.231.149:554/live/1/43CE6F9443445D9A/2274eac3c178b23c.sdp?id=guest&t=1315322133&en=3f9b071f939290361dc0952a8a403470&rs=wap";
		chengdu1[14] = "rtsp://218.205.231.149:554/live/1/4AAD1EF95EDD6C0B/009890d3c40d8f72.sdp?id=guest&t=1315322134&en=3ab6f30e7bdd69c500de52daccefa13d&rs=wap";
		chengdu1[15] = "rtsp://218.205.231.149:554/live/1/7E71637404F7667F/b63509c805db377b.sdp?id=guest&t=1315322134&en=3ab6f30e7bdd69c500de52daccefa13d&rs=wap";
		chengdu1[16] = "rtsp://218.205.231.149:554/live/1/730108A4299325B3/4a6d9eeb65c5007c.sdp?id=guest&t=1315322134&en=3ab6f30e7bdd69c500de52daccefa13d&rs=wap";
		chengdu1[17] = "rtsp://218.205.231.149:554/live/1/03F5400F3D3C52B8/a00c4e7152a862f1.sdp?id=guest&t=1315322641&en=072db6af062f1ab11719836ea94fb9da&rs=wap";
		chengdu1[18] = "rtsp://218.205.231.149:554/live/1/64C446AD39850BB7/955cd2c3d22ff316.sdp?id=guest&t=1315322641&en=072db6af062f1ab11719836ea94fb9da&rs=wap";
		chengdu1[19] = "rtsp://218.205.231.149:554/live/1/45F44D7D2DB87DF3/2f011eec4bbe9628.sdp?id=guest&t=1315322641&en=072db6af062f1ab11719836ea94fb9da&rs=wap";
		chengdu1[20] = "rtsp://218.205.231.149:554/live/1/38F1636968AB7AD3/bfe5dc576dd7160f.sdp?id=guest&t=1315322641&en=072db6af062f1ab11719836ea94fb9da&rs=wap";
		chengdu1[21] = "rtsp://218.205.231.149:554/live/1/55201E55160872A4/1bf38cc650e77a18.sdp?id=guest&t=1315322642&en=1827760c1e2fc93270c4994cd81a7fc6&rs=wap";
		chengdu1[22] = "rtsp://218.205.231.149:554/live/1/30C34A0446F274C9/aaa0d3e99c64b86d.sdp?id=guest&t=1315322642&en=1827760c1e2fc93270c4994cd81a7fc6&rs=wap";
		chengdu1[23] = "rtsp://218.205.231.149:554/live/1/4C2478001D326FBE/8321451484038538.sdp?id=guest&t=1315322643&en=d4be269c26068fa87eb891aea52c699e&rs=wap";
		chengdu1[24] = "rtsp://218.205.231.149:554/live/1/39F871BD7D2463FC/4154393455093094.sdp?id=guest&t=1315322643&en=d4be269c26068fa87eb891aea52c699e&rs=wap";
		chengdu1[25] = "rtsp://218.205.231.149:554/live/1/1A3079C118906ECE/8998666416335684.sdp?id=guest&t=1315322644&en=5ba4ea38e6a6f813144d0d7d904e990e&rs=wap";
		chengdu1[26] = "rtsp://218.205.231.149:554/live/1/31C4553B144C32AB/4294667198120919.sdp?id=guest&t=1315322644&en=5ba4ea38e6a6f813144d0d7d904e990e&rs=wap";
		chengdu1[27] = "rtsp://218.205.231.149:554/live/1/52D06C5101C16E0C/0887043257145607.sdp?id=guest&t=1315322645&en=152a6b943275e7f06d812edb148d80e0&rs=wap";
		chengdu1[28] = "rtsp://218.205.231.149:554/live/1/7BA64B081FEE128A/0356973363663145.sdp?id=guest&t=1315322646&en=d2270c43f6b4c8e4948171fa6095e18f&rs=wap";
		chengdu1[29] = "rtsp://218.205.231.149:554/live/1/2CBE124B67C85A59/7f43f0a5e68a0f59.sdp?id=guest&t=1315322646&en=d2270c43f6b4c8e4948171fa6095e18f&rs=wap";
		chengdu1[30] = "rtsp://218.205.231.149:554/live/1/0B9D117B610D2B43/5623034104727649.sdp?id=guest&t=1315322647&en=2d43de4b3234939d0dc08e30ac753424&rs=wap";
		chengdu1[31] = "rtsp://218.205.231.149:554/live/1/0B5804474F0A793D/6076531802341633.sdp?id=guest&t=1315323505&en=de3aa20091622d104608cb2a9210eb34&rs=wap";
		RTSPS = chengdu1;
	}

	private static final String[] CAMERA_DATA = {"二环路", "一环路","华阳"};
		
		
		private ArrayList<HashMap<String,Object>>  mCameraDate;
		SimpleAdapter mListAdapter;
		ListView mListView;
		

		@Override
		protected void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);

		//	requestWindowFeature(Window.FEATURE_NO_TITLE);
			setContentView(R.layout.city);
			mListView = getListView();
			initListAdapter();
			

		}

		private void initListAdapter() {
			//getDraftData();
			mCameraDate = new ArrayList<HashMap<String, Object>>();
			for(int i=0;i<31;i++)   
			{
				HashMap<String, Object> map = new HashMap<String, Object>(); 
				map.put("icon", R.drawable.camera); 
		        map.put("name", CITIES[i]);
		        map.put("rtsp", RTSPS[i]);
		        map.put("arrow", R.drawable.arrow);   
		        mCameraDate.add(map);
			}
			mListAdapter = new SimpleAdapter(this,mCameraDate,  
		            R.layout.main_listitem,      
		            new String[] {"icon","name", "arrow"},     
		            new int[] {R.id.ItemImage,R.id.ItemTitle,R.id.item_arrow}   
		        );   
		                
		 mListView.setAdapter(mListAdapter);   

		 mListView.setOnItemClickListener(new OnItemClickListener() {   
		  @Override  
	      public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {   
				Intent intent = new Intent (CityActivity.this, RtPlayActivity.class);
				Bundle bund = new Bundle();
				bund.putString("CameraName", mCameraDate.get(arg2).get("name").toString());
				bund.putString("CameraRtsp", mCameraDate.get(arg2).get("rtsp").toString());
				intent.putExtras(bund);
				startActivity(intent);
	        }   
	    });
		}
		

}
